﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace spacex.util.Converters
{
    /// <summary>
    /// Converter converts the passed window height to the appropriate grid height
    /// </summary>
    public class ZoomToPercentageConverter : IValueConverter
    {
        /// <summary>
        /// Converts a Slider value into a Zoom Percentage
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double zoomCurrent = double.Parse(value.ToString());
            double zoomMax = double.Parse(parameter.ToString());

            return (int) (100 / zoomMax * zoomCurrent) + " %";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
